//my header
#include "stdafx.h"

//takes in the input file and the storage variables for the various city stats
int Input(FILE *ifp, char city [], int *pop, int *sqMil, int *pollu, int *crime, int *expense, int *highway){//change to pointers
	
	/*scans each line in the input file until it reaches EOF, assigning each statistic to its
	corresponding variable, if there is another line it returns 0 else it returns -1
	*/
	if (fscanf(ifp, "%s %d %d %d %d %d %d",city, pop, sqMil , pollu, crime, expense, highway) != EOF){
		
		return 0;
	}
	else
		return -1;

}

//prints out the header for the console
void FirstPrint(){

	//aligns and prints the header for the console window
	printf("%-20s %-20s %s %c", "City", "Population Dens", "Livability Score" , '\n');
}

//prints the cities to the console window line by line
void Output(char city [], double PopDens, double Livability){
	
	//prints out each city along with its population density and its livability rating
	printf("%-24s %-22.2f %.2f %c", city, PopDens, Livability, '\n');
	
}

//prints the final analysis of the cities
void FinalPrint(char BestCity[], int count, double Compare){
	
	//Prints out the number of input cities, the name of the BestCity stored in "Best City" and the livability rating stored in Compare
	printf("%s %d %s %s %s %.2f %c", "Of the", count,  "cities, the most liveable was", BestCity, "with a liveablility score of", Compare, '\n');
	
}